package com.zygh.lz.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zygh.lz.dao.IntegrationPlatformMapper;
import com.zygh.lz.entity.IntegrationPlatform;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class IntegrationPlatformService extends ServiceImpl<IntegrationPlatformMapper, IntegrationPlatform> {
    @Resource
    private IntegrationPlatformMapper integrationPlatformMapper;


    /**
     * 根据账号查询
     */
    public IntegrationPlatform getPlatform(String user) {
        return integrationPlatformMapper.selectOne(Wrappers.<IntegrationPlatform>lambdaQuery()
                .eq(IntegrationPlatform::getUsername, user));

    }


    /**
     * 新增，插入所有字段
     *
     * @param integrationPlatform 新增的记录
     * @return 返回影响行数
     */
    public int insert(IntegrationPlatform integrationPlatform) {
        return integrationPlatformMapper.insert(integrationPlatform);
    }


    /**
     * 修改，修改所有字段
     *
     * @param integrationPlatform 修改的记录
     * @return 返回影响行数
     */
    public int update(IntegrationPlatform integrationPlatform) {
        return integrationPlatformMapper.updateById(integrationPlatform);
    }


    /**
     * 删除记录
     */
    public int delete(Integer id) {
        return integrationPlatformMapper.deleteById(id);
    }

}
